package com.netsdk.lht2.handle;

import com.netsdk.lht2.handle.support.*;
import com.netsdk.lib.enumeration.EM_EVENT_IVS_TYPE;

import java.io.IOException;
import java.util.EnumMap;

import static com.netsdk.lib.enumeration.EM_EVENT_IVS_TYPE.*;

public class EventHandleUtil {
    private final static EnumMap<EM_EVENT_IVS_TYPE,EventHandle> map = new EnumMap<>(EM_EVENT_IVS_TYPE.class);
    static {
        // 初始化 EventHandle
        map.put(EVENT_IVS_TRAFFIC_PEDESTRAIN,new EVENT_IVS_TRAFFIC_PEDESTRAIN_HANDLE());
        try {
            map.put(EVENT_IVS_TRAFFIC_FLOWSTATE,new EVENT_IVS_TRAFFIC_FLOWSTATE_HANDLE());
        } catch (IOException e) {
            e.printStackTrace();
        }
        map.put(EVENT_IVS_TRAFFIC_NONMOTOR,new EVENT_IVS_TRAFFIC_NONMOTOR_HANDLE());
        map.put(EVENT_IVS_TRAFFIC_PARKING,new EVENT_IVS_TRAFFIC_PARKING_HANDLE());
        map.put(EVENT_IVS_TRAFFICACCIDENT,new EVENT_IVS_TRAFFICACCIDENT_HANDLE());
//        map.put(EVENT_IVS_TRAFFIC_REAREND_ACCIDENT,new EVENT_IVS_TRAFFICACCIDENT_HANDLE());
        map.put(EVENT_IVS_TRAFFIC_RETROGRADE,new EVENT_IVS_TRAFFIC_RETROGRADE_HANDLE());
        map.put(EVENT_IVS_TRAFFICJAM,new EVENT_IVS_TRAFFICJAM_HANDLE());
    }

    public static EventHandle get(EM_EVENT_IVS_TYPE emEventIvsType){
        return map.get(emEventIvsType);
    }


}
